<template>
  <!-- https://www.antdv.com/components/drawer-cn/ 的基础抽屉 -->
  <div>
    <a-drawer
      placement="right"
      :closable="false"
      :visible="visible"
      @close="onClose"
      width="300px"
    >
      <template v-slot:handle>
        <div class="setting-drawer-handle" @click="visible = !visible">
          <a-icon :type="visible ? 'close' : 'setting'" />
        </div>
      </template>
      <div>
        <div>
          <h2>整体风格定制</h2>
          <a-radio-group 
          :value="$route.query.navTheme || 'dark'"
          @change="e => handleSettingChange( 'navTheme' ,e.target.value)"
          >
            <a-radio value="dark"> 夜间模式 </a-radio>
            <a-radio value="light"> 白天模式 </a-radio>
          </a-radio-group>

          <h2>导航模式</h2>
          <a-radio-group 
          @change="e => handleSettingChange( 'navLayout' ,e.target.value)"
          :value="$route.query.navLayout || 'left'"
          >
            <a-radio value="left"> 左侧 </a-radio>
            <a-radio value="top"> 顶部 </a-radio>
          </a-radio-group>
        </div>
      </div>
    </a-drawer>
  </div>
</template>
<script>
export default {
  data() {
    return {
      visible: false,
      
    };
  },
  
  methods: {
    onClose() {
      this.visible = false;
    },
    handleSettingChange(type,value) {
      this.$router.push({
        query:{
          ...this.$route.query, [type]:value
        }
      })
    }
  },
};
</script>


<style lang="less" src="./index.less">

</style>